#ifndef QUEUE_H
#define QUEUE_H

#include "deque.h"

/*
 * queue 依赖 deque ，头尾可进可出的特性，实现了队列形式的先进先出
*/

template <class T, class _Sequence = deque<T>>
class queue {
public:
  typedef typename _Sequence::value_type      value_type;
  typedef typename _Sequence::size_type       size_type;
  typedef          _Sequence                  container_type;

  typedef typename _Sequence::reference       reference;
  typedef typename _Sequence::const_reference const_reference;
protected:
  _Sequence c;
public:

  bool empty() const { return c.empty(); }
  size_type size() const { return c.size(); }
  reference front() { return c.front(); }
  const_reference front() const { return c.front(); }
  reference back() { return c.back(); }
  const_reference back() const { return c.back(); }
  void push(const value_type& __x) { c.push_back(__x); }//在尾部添加一个数据
  void pop() { c.pop_front(); }//在头部删除一个元素
};



#endif // QUEUE_H
